﻿using B.S.Domain.Ticket;
using B.S.Infratrctrue;
using B.S.Requst;
using MediatR;

namespace B.S.Data.MES.API.Applications.Dingdan
{
    public class dingdanQueryCommandHandler : IRequestHandler<dingdanQueryCommand, APIRequst<List<DingDan>>>
    {
        public dingdanQueryCommandHandler(IBaseRepository<DingDan> dindanRepository)
        {
            DindanRepository = dindanRepository;
        }

        public IBaseRepository<DingDan> DindanRepository { get; }

        public async Task<APIRequst<List<DingDan>>> Handle(dingdanQueryCommand request, CancellationToken cancellationToken)
        {
            var path = DindanRepository.GetAll().ToList();
            return new APIRequst<List<DingDan>>
            {
                Code = RequstCode.成功,
                Msg = "查询成功",
                Data = path
            };
        }
    }
}
